<template>
  <BasicDialog ref="basicDialog" :isVisible="isAlert" width="60%" :title="'查看'" :isShowSure="false">
    <template #content>
      <el-form ref="formRef" :model="formInfo"  label-width="120px">
        <el-form-item label="日志id：" >          
          <span >{{ formInfo.id }}</span>
        </el-form-item>
        <el-form-item label="用户名称：" >
          <span >{{ formInfo.userName }}</span>
        </el-form-item>
        <el-form-item label="登录账号：" >
          <span >{{ formInfo.loginName }}</span>
        </el-form-item>
        <el-form-item label="模块" >
          <span >{{ formInfo.model }}</span>
        </el-form-item>
        <el-form-item label="操作" >
          <span >{{ formInfo.optDesc }}</span>
        </el-form-item>
        <el-form-item label="请求方法" >
          <span >{{ formInfo.reqMethod }}</span>
        </el-form-item>
        <el-form-item label="请求参数" >
          <span >{{ formInfo.reqParameters }}</span>
        </el-form-item>
        <el-form-item label="执行开始时间" >
          <span >{{ formInfo.starttime }}</span>
        </el-form-item>
        <el-form-item label="执行结束时间" >
          <span >{{ formInfo.endtime }}</span>
        </el-form-item>
        <el-form-item label="请求总时长(ms)" >
          <span >{{ formInfo.optTime }}</span>
        </el-form-item>
        <el-form-item label="用户IP：" >
          <span >{{ formInfo.userIp }}</span>
        </el-form-item>
      </el-form>
    </template>
  </BasicDialog>
</template>
<script lang='ts' setup>
import { FormInfo } from "@components/common/BasicForm/BasicFormTypes";
import type { FormRules, FormInstance } from 'element-plus';
import { getOperatorLogById } from "@/request/apis/system/operatorLog"
const props = defineProps({
  info: {
    type: Object,
    default: () => {
      return {}
    }
  },
  isAlert: {
    type: Boolean,
    default: false
  },
})

const $emits = defineEmits([
  "closeDialog"
])

// 提交表单校验
const formRef = ref<FormInstance>();
const basicDialog = ref();

//表单数据 
let formInfo = ref<FormInfo>({});

onMounted(async () => {
  formInfo.value = await getOperatorLogById(props.info.id)
})

</script>

<style scoped lang="scss"></style>